package com.sky.mapper;

import com.github.pagehelper.Page;
import com.sky.annotation.AutoFill;
import com.sky.dto.SetmealDTO;
import com.sky.dto.SetmealPageQueryDTO;
import com.sky.entity.Setmeal;
import com.sky.enumeration.OperationType;
import com.sky.vo.DishItemVO;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;
import java.util.Map;

@Mapper
public interface SetmealMapper {
  

    Page<Setmeal> PageQuery(SetmealPageQueryDTO setmealPageQueryDTO);


    @AutoFill(OperationType.INSERT)
    void AddSetmeal(Setmeal setmeal);

    @Select("select *from setmeal where id = #{id}")
    Setmeal FindSetmealById(Integer id);

    @AutoFill(OperationType.UPDATE)
    void UpdateStutas(Setmeal setmeal);

    @AutoFill(OperationType.UPDATE)
    void UpDateSetmeal(Setmeal setmeal);

    @Delete("DELETE FROM setmeal WHERE id = #{id}")
    void DeleteSetmealList(Long id);

    Integer countByMap(Map map);

    @Select("select * from setmeal where category_id = #{categoryId}")
    List<Setmeal> GetUserSetmealList(Long categoryId);

    @Select("select * from setmeal_dish where setmeal_id =#{id}")
    List<DishItemVO> GetDishBySetmealId(Integer id);

    @Select("select * from setmeal where id = #{setmealId}")
    Setmeal getById(Long setmealId);
}
